﻿namespace LogManager.Core.Factories
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Xml.Linq;
    using LogManager.Core.Models;
    using LogManager.Core.Models.Smtp;
    using LogManager.Core.Providers;

    public class DefaultXmlElementFactory : XmlElementFactoryBase
    {
        public override IXmlTemplateProvider TemplateProvider { get; protected set; }

        public DefaultXmlElementFactory()
        {
            this.TemplateProvider = new DefaultXmlTemplateProvider();
        }

        public override Location CreateLocation(XElement baseNode, IServer parent)
        {
            return new Location(baseNode, parent);
        }

        public override Server CreateServer(XElement baseNode, IPlateform parent)
        {
            return new Server(baseNode, parent, this);
        }

        public override Plateform CreatePlateform(XElement baseNode, IWarehouse parent)
        {
            return new Plateform(baseNode, parent, this);
        }

        public override Warehouse CreateWarehouse(XElement baseNode, IConfiguration parent)
        {
            return new Warehouse(baseNode, parent, this);
        }

        public override Configuration CreateConfiguration(XDocument baseDocument)
        {
            return new Configuration(baseDocument, this);
        }

        public override Settings CreateSettings(XElement baseNode)
        {
            return new Settings(baseNode, this);
        }

        public override SmtpSettings CreateSmtpSettings(XElement baseNode)
        {
            return new SmtpSettings(baseNode, this);
        }

        public override SmtpServer CreateSmtpServer(XElement baseNode)
        {
            return new SmtpServer(baseNode);
        }

        public override From CreateSmtpFrom(XElement baseNode)
        {
            return new From(baseNode);
        }

        public override To CreateSmtpTo(XElement baseNode)
        {
            return new To(baseNode);
        }
    }
}
